﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Position.ascx.cs" Inherits="Admin_Hurman_Controls_Position" %>
<%@ Register TagPrefix="avg" Namespace="Avg.Controls" Assembly="SmartPager" %>

<script src="/Admin/js/position.js" type="text/javascript"></script>

<h2>
    Danh sách nhân sự</h2>
<div class="func">
    <ul>
        <li class="refresh"><a href="/Admin/Hurman/Position.aspx">Đọc dữ liệu</a></li>
        <li class="search"><span box="search">Tìm kiếm</span></li>
        <li class="role"><span box="addrole" table="grid">Thêm quyền</span></li>
    </ul>
    <div style="clear: both">
    </div>
</div>
<div class="search">
    <table width="100%" style="font-family: Arial">
        <tr>
            <td width="100">
                <b>Chi nhánh</b>
            </td>
            <td>
                <asp:DropDownList ID="ddlBranch1" runat="server" AppendDataBoundItems="true" Width="200px">
                    <asp:ListItem Value="">----- Chọn chi nhánh ------------</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                <b>Phòng ban</b>
            </td>
            <td>
                <asp:DropDownList ID="ddlDepart1" runat="server" AppendDataBoundItems="true" Width="200px">
                    <asp:ListItem Value="">----- Chọn phòng ban ----------</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                <b>Chức vụ</b>
            </td>
            <td>
                <asp:DropDownList ID="ddlJob1" runat="server" AppendDataBoundItems="true" Width="200px">
                    <asp:ListItem Value="">----- Chọn chức vụ ----------</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                <b>Nhóm</b>
            </td>
            <td>
                <asp:DropDownList ID="ddlGroup1" runat="server" AppendDataBoundItems="true" Width="200px">
                    <asp:ListItem Value="">----- Chọn nhóm ----------</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                <b>Danh số / user id</b>
            </td>
            <td>
                <asp:TextBox ID="txtuser" runat="server" Width="450px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <b></b>
            </td>
            <td>
                <span class="button">
                    <asp:Button ID="btSearch" runat="server" Text="Xem" OnClick="btSearch_Click" />
                    <span></span></span>
            </td>
        </tr>
    </table>
</div>
<div id="tab">
    <ul>
        <li><a href="#hurman"><span>Danh sách nhân sự</span></a></li>
        <li><a href="#new-hurman"><span>Nhân viên mới</span></a></li>
    </ul>
    <div id="hurman">
        <table class="grid alter">
            <tr>
                <th colspan="2">
                </th>
                <th width="45px">
                </th>
                <th width="45px">
                </th>
                <th>
                    Tên
                </th>
                <th width="70px">
                    Chi nhánh
                </th>
                <th width="80px">
                    Phòng ban
                </th>
                <th width="120px">
                    Chức vụ
                </th>
                <th width="120px">
                    Nhóm
                </th>
                <th width="40">
                    <input type="checkbox" value="" />
                </th>
                <th width="40">
                    <div class="click position" action="edit-multi">
                        <img src="/images/button/user-online.png" />
                    </div>
                </th>
                <th width="40">
                </th>
                <th width="40">
                </th>
            </tr>
            <asp:Repeater ID="repPosition" runat="server" OnItemCommand="repPosition_ItemCommand">
                <ItemTemplate>
                    <tr>
                        <td align="right" width="20px" style="border-right: none;" <%# Convert.ToInt32(Eval("SubPosition")) > 0 ? "rowspan='2'" : "" %>>
                            <%# Container.ItemIndex + 1 %>
                        </td>
                        <td width="10px" style="border-left: none; padding-right: 5px" align="left" <%# Convert.ToInt32(Eval("SubPosition")) > 0 ? "rowspan='2'" : "" %>>
                            <div class='sub sub-<%# Eval("UserName") %>' isload="false" user='<%# Eval("UserName") %>'>
                                <%# getImageSub(Convert.ToInt32(Eval("SubPosition"))) %>
                            </div>
                        </td>
                        <td align="center">
                            <%# Eval("AgentNumber")%>
                        </td>
                        <td align="center">
                        <%# Eval("MachineId") %>
                        </td>
                        <td>
                            <%# Eval("UserName") %>
                        </td>
                        <td>
                            <%# Eval("BranhCode") %>
                        </td>
                        <td>
                            <%# Eval("DepartCode") %>
                        </td>
                        <td>
                            <%# Eval("JobName") %>
                        </td>
                        <td>
                            <%# Eval("AgentGroupName")%>
                        </td>
                        <td align="center">
                            <asp:CheckBox runat="server" is="true" user='<%# Eval("UserName") %>' fullname='<%# Eval("FullName") %>' />
                        </td>
                        <td align="center">
                            <div title="Phòng ban chính" class="click position" user='<%# Eval("UserName") %>' action="edit" item='<%# Eval("BranchId").ToString() + "|" + Eval("DepartId").ToString() + "|" + Eval("JobId").ToString() + "|" + Eval("GroupId").ToString() %>'>
                                <img src="/images/button/user-online.png" />
                            </div>
                        </td>
                        <td align="center">
                            <div title="Phòng ban phụ" class="click position" user='<%# Eval("UserName") %>' action="add-sub" item='<%# Eval("BranchId").ToString() + "|" + Eval("DepartId").ToString() + "|" + Eval("JobId").ToString() + "|" + Eval("GroupId").ToString() %>'>
                                <img src="/images/button/user-sub.png" />
                            </div>
                        </td>
                        <td align="center">
                            <% if (IsDelete())
                               { %>
                            <asp:LinkButton ID="del" runat="server" OnClientClick="return confirm('Xác nhận xóa?')"
                                CommandName="del" CommandArgument='<%# Eval("UserName") %>' ValidationGroup="Cancel"><img src="/images/button/delete.png" />
                            </asp:LinkButton>
                            <%}
                               else
                               { %>
                            <img src="/images/button/delete2.png" />
                            <%} %>
                        </td>
                    </tr>
                    <tr runat="server" visible='<%# Convert.ToInt32(Eval("SubPosition")) > 0 ? true : false %>'
                        hover="false">
                        <td colspan="7" style="display: none; padding: 0; margin: 0" class='<%# Eval("UserName") %>'>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
        </table>
        <avg:SmartPager ID="smartPager" runat="server" Visible="false" />
    </div>
    <div id="new-hurman">
        <table class="grid alter">
            <tr>
                <th width="40px">
                </th>
                <th>
                    Tên nhân viên
                </th>
                <th width="40px">
                </th>
            </tr>
            <asp:Repeater ID="repUsers" runat="server">
                <ItemTemplate>
                    <tr>
                        <td align="center">
                            <%# Container.ItemIndex + 1 %>
                        </td>
                        <td>
                            <%# Eval("UserName") %>
                        </td>
                        <td align="center">
                            <div class="click position" user='<%# Eval("UserName") %>'>
                                <img src="/images/button/user-online.png" />
                            </div>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
        </table>
    </div>
</div>
<style type="text/css">
    div#form select
    {
        font-family: Arial;
    }
    div#form table tr td
    {
        padding: 5px 0;
    }
    div .sub
    {
        cursor: pointer;
    }
    div .sub img
    {
        vertical-align: middle;
    }
    #form select
    {
        width: 250px;
    }
</style>
<div id="form" title="Phân bổ nhân viên">
    <div id="content" style="font-family: Arial">
        <div id="update">
            <div id="user-login" style="border-bottom: solid 1px #AAA; margin-bottom: 5px; padding-bottom: 5px">
                <table width="100%">
                    <tr>
                        <td width="120px">
                            <b>Tên đăng nhập</b>
                        </td>
                        <td>
                            <label id="lblUser">
                            </label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <b>Tên nhân viên</b>
                        </td>
                        <td>
                            <label id="lblFullName">
                            </label>
                        </td>
                    </tr>
                </table>
            </div>
            <div id="user-login-multi" style="display: none;border-bottom: solid 1px #AAA; margin-bottom: 5px; padding-bottom: 5px">
                
            </div>
            <p id="validateTips" class="valid-erorr">
            </p>
            <table width="100%">
                <tr>
                    <td width="120px">
                        <b>Chi nhánh</b>
                    </td>
                    <td>
                        <div id="divBranch">
                            <asp:DropDownList ID="ddlBranch" runat="server" AppendDataBoundItems="true">
                                <asp:ListItem Value="">----------- Chọn chi nhánh ------------</asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Phòng ban</b>
                    </td>
                    <td>
                        <div id="divDepart">
                            <select id="ddlDepart">
                                <option value="">----------- Chọn phòng ban ----------</option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Chức vụ</b>
                    </td>
                    <td>
                        <div id="divJob">
                            <select id="ddlJob">
                                <option value="">----------- Chọn chức vụ ----------</option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Nhóm</b>
                    </td>
                    <td>
                        <div id="divGroup">
                            <select id="ddlGroup">
                                <option value="">----------- Chọn nhóm ----------</option>
                            </select>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <table width="100%" style="display: none" id="loading">
            <tr height="200px">
                <td align="center">
                    <img src="/images/ajax-loader.gif" />
                </td>
            </tr>
        </table>
    </div>
</div>
